package job1;

public class PrimeNumber {

    public static final int NUM = 20000;

    public static void main(String[] args) {
        int count = 0;
        for (int i = 1; i <= NUM; i++) {
            if (isPrime(i)) {
                System.out.print(i + " ");
                count++;
                if (count % 5 == 0) {
                    System.out.println();
                }
            }
        }
    }

    public static boolean isPrime(int num) {
        if (num <= 1) {
            return false;
        }
        for (int i = 2; i * i <= num; i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }
}